import re
from time import *

# TODO: Error check checksums!

MaxLat=-10000
MinLat=10000
MaxLon=-10000
MinLon=100000

def ParseGPRMC(line):
    #print line
    global MaxLat
    global MinLat
    global MaxLon
    global MinLon
    gpsParts = line.split(',')
    if float(gpsParts[3]) > MaxLat:
        MaxLat=float(gpsParts[3])
        print 'New MaxLat',MaxLat
    if float(gpsParts[3]) < MinLat:
        MinLat=float(gpsParts[3])
        print 'New MinLat',MinLat
    if float(gpsParts[5]) > MaxLon:
        MaxLon=float(gpsParts[5])
        print 'New MaxLon',MaxLon
    if float(gpsParts[5]) < MinLon:
        MinLon=float(gpsParts[5])
        print 'New MinLon',MinLat

    #sleep(.1)



with open("C:\Users\jmurray\Desktop\putty.log",'r') as f:
    for line in f:
        if line[0:6]=="$GPRMC":
            ParseGPRMC(line)
print "Lat Range:",MinLat,'<->',MaxLat
print "Lon Range:",MinLon,'<->',MaxLon